﻿using System;

namespace Demo1
{
    class Program
    {
        static void Main(string[] args)
        {
            Text10();
        }

        static void Text3()
        {
            String[] srt = { "叶", "真", "是", "傻", "逼" };
            for (int i = 0; i < srt.Length; i++)
            {
                if (i % 2 == 0)
                {
                    Console.WriteLine(srt[i]);
                }
            }
        }
        static void Text4()
        {
            //输入一行字符串，分别统计出其中英文字母、数字、空格的个数。
            Console.WriteLine("请输入一串字符串");
            string a = Console.ReadLine(); ;
            int letter = 0;
            int digit = 0;
            int Punctuation = 0;
            int WhiteSpace = 0;
            int sum = 0;
            foreach (var tt in a)
            {
                if (char.IsLetter(tt))
                {
                    letter++;
                }
                if (char.IsWhiteSpace(tt))
                {
                    WhiteSpace++;
                }
                if (char.IsPunctuation(tt))
                {
                    Punctuation++;
                }
                if (char.IsDigit(tt))
                {
                    digit++;
                }

            }
            Console.WriteLine("字母数=" + letter + ",数字数=" + digit + ",空格数=" + WhiteSpace + ",符号数=" + Punctuation);

        }

        static void Text5()
        {
            double[] a = new double[5];
            double sum = 0;
            double avg = 0;
            for (int i = 0; i < a.Length; i++)
            {
                Console.WriteLine("请输入第" + (i + 1) + "个数");
                a[i] = Convert.ToDouble(Console.ReadLine());
            }
            foreach (var tt in a)
            {
                sum = sum + tt;
                avg = sum / a.Length;
            }
            Console.WriteLine("总分=" + sum + ",平均分=" + avg);
        }
        static void Text6()
        {
            int[] a = { 1, 6, 8, 4, 9, 5, 3 };
            int temp;
            for (int i = 0; i < a.GetLength(0) - 1; i++)
            {
                for (int j = 0; j < a.GetLength(0) - 1 - i; j++)
                {
                    if (a[j] < a[j + 1])
                    {
                        temp = a[j];
                        a[j] = a[j + 1];
                        a[j + 1] = temp;
                    }
                }
            }
            foreach (var bb in a)
            {
                Console.WriteLine(bb);
            }

        }
        static void Text7()
        {
            int[] a = { 1,2,3,4,5,6,7,8,9};
            int index=-2;
            Console.WriteLine("请输入一个数字");
            int temp = Convert.ToInt32(Console.ReadLine());
            for (int i = a.Length-1; i >= 0; i--)
            {
                if (a[i]==temp)
                {
                    index = i;
                    break;
                }
                else if (a[i]!=temp)
                {
                    if (i==0)
                    {
                        index = -1;
                    }
                }
            }
            if (index==-1)
            {
                Console.WriteLine("该数组中不存在该数字");
            }
            else
            {
                Console.WriteLine("该数字在数组中的位置是"+index);
            }
        }
        static void Text8()
        {
            for (int i = 1; i <10; i++)
            {
                for (int j = 1; j <=i; j++)
                {
                    Console.Write(j + "*" + i + "=" + (j * i) + "\t");
                }
                Console.WriteLine();
            }
        }
        static void Text9()
        {
            Console.WriteLine("请输入一个数字");
            int a=Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i <a; i++)
            {
                if (i==0||i==a-1)
                {
                    for (int j = 0; j < a; j++)
                    {
                        Console.Write("*");
                    }
                }
                else
                {
                    for (int x = 0; x < a; x++)
                    {
                        if (x==0||x==a-1)
                        {
                            Console.Write("*");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                    }
                }
                Console.WriteLine();
            }
        }
        static void Text10()
        {
            for (int x = 1; x <=5; x++)
            {
                for (int y = 0; y <3-x; y++)
                {
                    Console.Write(" ");
                }
                for (int z = 0; z <x-3; z++)
                {
                    Console.Write(" ");
                }
                for (int i = 0; i <(2*x)-1; i++)
                {
                    Console.Write("*");
                }
                for (int j = 5; j < 2;j--)
                {
                    Console.Write("*");
                }
                Console.WriteLine();
            }
        }

    }
}
